package action.articleclass;

import java.util.Map;

import org.apache.struts2.ServletActionContext;

import service.ArticleClassService;
import bean.ArticleClass;
import bean.User;

import com.opensymphony.xwork2.ActionSupport;

public class SaveArticleClassAction extends ActionSupport {
	private ArticleClass articleClass;
	private ArticleClassService articleClassService;
	
	@Override
	public String execute() throws Exception {
		Map session=ServletActionContext.getContext().getSession();
		User u=(User) session.get("user");
		articleClass.setUser(u);
		if(articleClassService.addArticleClass(articleClass))
			return SUCCESS;
		else 
			return INPUT;
	}

	public ArticleClass getArticleClass() {
		return articleClass;
	}

	public void setArticleClass(ArticleClass articleClass) {
		this.articleClass = articleClass;
	}

	public ArticleClassService getArticleClassService() {
		return articleClassService;
	}

	public void setArticleClassService(ArticleClassService articleClassService) {
		this.articleClassService = articleClassService;
	}
}
